# Maintainer: Peter Budai <peterbudai at hotmail dot com>

_realname=flickcurl
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.26
pkgrel=2
pkgdesc="Flickcurl is a C library for the Flickr API (mingw-w64)"
arch=('any')
url="http://librdf.org/flickcurl/"
license=("LGPLv2")
depends=("${MINGW_PACKAGE_PREFIX}-curl"
         "${MINGW_PACKAGE_PREFIX}-libxml2")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-libtool"
             "${MINGW_PACKAGE_PREFIX}-gtk-doc")
source=("http://download.dajobe.org/flickcurl/flickcurl-${pkgver}.tar.gz"
        flickcurl-1.26-build.patch)
sha256sums=('ff42a36c7c1c7d368246f6bc9b7d792ed298348e5f0f5d432e49f6803562f5a3'
            'e4c9dcedf4752e4fcaa623f13e0e8f2632854e2bf365b72a772023118613b059')

prepare() {
  cd ${srcdir}/flickcurl-${pkgver}
  patch -p1 -i "${srcdir}"/flickcurl-1.26-build.patch

  NOCONFIGURE=1 ./autogen.sh --enable-gtk-doc=yes
}

build() {
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-static \
    --enable-shared \
    --enable-gtk-doc=yes

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
}
